<?php

/**
 * Description of XDS_DataSource_ResultProvider
 *
 * @author prometheus
 */
class XDS_DataSource_ResultProvider extends x10_Provider
{
	public $xName = 'Adatforrás lekérési eredmény szolgáltató';

	/**
	 * @var XDS_RecordSet
	 */
	protected $recordset;

	public function __construct(x10_Config $config)
	{
		parent::__construct($config);

		$this->recordset = $this->config->getConfigKey('recordset');
	}

	public function get()
	{
		return $this->recordset;
	}

	public function getRS()
	{
		return $this->recordset;
	}

	/**
	 * JSON kimenet!
	 */
	public function __toString()
	{
		$array = array();
		foreach ($this->recordset as $record)
		{
			$array[] = $record->get();
		}
		return json_encode($array);
	}
}

?>